package com.dg11185.nearshop.net.request;

import com.dg11185.libs.utils.MD5.MD5Utils;
import com.dg11185.nearshop.app.Constants;
import com.dg11185.nearshop.net.HttpCacheRequest;
import com.dg11185.nearshop.net.response.GetDayMerListResponse;

/**
 * 获取会员日商家
 * 
 * @author：Daibo
 * @time：2014-5-16 下午1:34:32
 */
public class GetDayMerListRequest extends
        HttpCacheRequest<GetDayMerListResponse> {
    public final static String AREA_NUM = "areaNum";

    public final static String WEEK = "week";

    public final static String MERCHANT_ID = "merchantId";// 当前页
    
    public final static String PAGE_NUM = "pageNumber";// 当前页

    public final static String PAGE_SIZE = "pageSize";// 每页数量

    public final static String TOKEN = "chshToken";

    public GetDayMerListRequest() {
        super(Constants.ADDRESS, Constants.getDayMerList);
        addParam("chshToken", Constants.TOKEN);
        setIsCreateFloder(true);
    }

    /**
     * <可选参数> <param name="industyId">行业ID</param> <param
     * name="merchantId">商家ID</param> <param name="merchantName">商家名称</param>
     * <param name="preferential">优惠类型</param> <param
     * name="week">0~6表示星期天到星期六</param> <param name="pageNumber">当前页码</param>
     * <param name="pageSize">每页数量</param> <param name="orderName">排序字段</param>
     * <param name="orderType">0.升序，1.降序</param> </可选参数>
     */
    public GetDayMerListRequest add(String key, String value) {
        addParam(key, value);
        return this;
    }

    public GetDayMerListRequest encryption() {
        addParam("chshSign", MD5Utils.getMD5Str(getParams(), Constants.MD5_key));
        return this;
    }

    @Override
    protected GetDayMerListResponse parseJson(String response) throws Exception {
        GetDayMerListResponse res = new GetDayMerListResponse();
        res.parseJson(response);
        return res;
    }

}
